<include file="layout/header" />
<!-- Right side column. Contains the navbar and content of the page -->
<script language="javascript">
    /*
     * 方法作用：更改form表单的action并提交
     */
    function changeStatus(obj){
        var str = "__CONTROLLER__/recordChange/status/" + obj;
        $("#formContractList").attr("action", str);
        var o = document.getElementsByName('selectedOne[]');
        var sid = new Array();
        for(x in o){
            if(o[x].checked == true){
                sid.push(o[x].value);
            }
        }
        if((sid.length)==0){
        	alert("请选择一条合同记录！");
        }else{
            $("#sid").val(sid);
            $("#formContractList").submit();        	
        }

    }
    /**
     *  返回，带上查询的单位名称条件
     */
    function fungoback(){
    	var str = "/Admin/Invoice/recordSearch";
    	$("#formContractList").attr("action", str);
    	$("#formContractList").submit(); 
  }    
</script>
<aside class="right-side">
    <section class="content-header">
        <h1>
            发票关联合同明细
            <small>Invoice Union Contract Detail</small>
        </h1>
    </section>
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <div class="box-body table-responsive">
                        <button class="btn btn-app btn-sm" onclick="changeStatus('已回款')">回款</button>
                        <form method="post" action="Contract/recordSearch" role="form" id="formContractList">                            
                            <input type="hidden" id="sid" name="sid"/>
                            <input type="hidden" id="p_name" name="p_name" value="{$p_name}" />
                        </form>
                        <table id="example2" class="table table-bordered table-hover text-left">
                            <thead>
                            <tr>
                                <th class="text-center">
                                    <input type="checkbox" id="chk_all" name="chk_all" onclick="select_all(this)" />                                    操作
                                </th>
                                <th class="text-center">序号</th>
                                <th class="text-center">客户名称</th>
                                <th class="text-center">签订日期</th>
                                <th class="text-center">合同金额</th>
                                <th class="text-center">发票编号</th>
                                <th class="text-center">合同状态</th>
                                <th class="text-center">订单编号</th>
                            </tr>
                            </thead>
                            <tbody>
                            <volist name="contracts" id="contract">
                                <tr>
                                    <td class="text-center">
                                        <input type="checkbox" name="selectedOne[]" value="{$contract.id}" />
                                    </td>
                                    <td class="text-center">{$i}</td>
                                    <td>{$contract.p_name}</td>
                                    <td>{$contract.c_date}</td>
                                    <td>{$contract.c_price}</td>
                                    <td>{$contract.i_no}</td>
                                    <td>{$contract.c_status}</td>
                                    <td>{$contract.order_no}</td>
                                </tr>
                            </volist>
                            </tbody>
                        </table>
                        <div class="form-group">                                
                                <button class="btn btn-primary btn-sm" onclick="fungoback();">返回</button>
                        </div>                        
                    </div><!-- /.box-body -->
                </div><!-- /.box -->
            </div>
        </div>
    </section>
</aside><!-- /.right-side -->
<include file="layout/footer" />
